//
//  JCLoginViewModel.m
//  JiFengDaRen
//
//  Created by 陈如意 on 2018/3/16.
//  Copyright © 2018年 陈永发. All rights reserved.
//

#import "JCLoginViewModel.h"

@implementation JCLoginViewModel

+ (void)getVerifyImgCodeSuccess:(void(^)(NSDictionary *result))success{
    
    UIViewController  *vc = [SHHelper currentViewController];

    [PPNetworkHelper GET:JgetImgCode parameters:nil cache:NO encrypt:NO decode:NO responseCache:^(id responseCache) {
        
    } success:^(id result) {
        if ([result[@"success"] boolValue] == YES) {
            if (result[@"data"] != nil) {
                success(result);
            }
        }else{
            [vc.view makeToast:result[@"data"] duration:1.5 position:@"center"];
        }
    } failure:^(NSError *error) {
        
    }];
    
}


+ (void)sendImgCodeParams:(NSDictionary *)dic
                  Success:(void(^)(NSDictionary * dict))success{
    
    [PPNetworkHelper GET:JsendCode parameters:dic cache:NO encrypt:NO decode:NO responseCache:^(id responseCache) {
        
    } success:^(id result) {
        success(result);
        
    } failure:^(NSError *error) {
        
    }];
}


+ (void)userRegisterParams:(NSDictionary *)dic
                   Success:(void(^)(id result))success{
   
//    UIViewController * vc = [SHHelper currentViewController];

//    [MBProgressHUD showHUDAddedTo:vc.view animated:YES];

    [PPNetworkHelper POST:Jregister parameters:dic cache:NO encrypt:NO decode:NO responseCache:^(id responseCache) {
        
    } success:^(id result) {
        success(result);
        
    } failure:^(NSError *error) {
//        [MBProgressHUD hideHUDForView:vc.view animated:YES];
    }];
  
}

+ (void)userLoginParams:(NSDictionary *)dic
                Success:(void(^)(id result))success
                Failure:(void(^)(NSError *error))failure{
    
    [PPNetworkHelper POST:Klogin parameters:dic cache:NO encrypt:YES decode:YES responseCache:^(id responseCache) {
        
    } success:^(id result) {
        success(result);
    } failure:^(NSError *error) {
        failure(error);
    }];
}

+ (void)userForgetPswParams:(NSDictionary *)dic
                    Success:(void(^)(id result))success{
    
    [PPNetworkHelper POST:KResetPsw parameters:dic cache:NO encrypt:YES decode:YES responseCache:^(id responseCache) {
        
    } success:^(id result) {
        success(result);
    } failure:^(NSError *error) {
        
    }];
}




@end
